package com.tc.biz.service.impl;

import com.tc.biz.entity.SysUser;
import com.tc.biz.mapper.SysUserMapper;
import com.tc.biz.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zengqingfa
 * @date 2019/10/18 15:43
 * @description
 * @email zengqingfa_java@163.com
 */
@Service
@Transactional
public class UserServiceImpl implements IUserService {

    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public int deleteByPrimaryKey(Long userId) {
        return sysUserMapper.deleteByPrimaryKey(userId);
    }

    @Override
    public int insert(SysUser record) {
        return sysUserMapper.insert(record);
    }

    @Override
    public int insertSelective(SysUser record) {
        return sysUserMapper.insertSelective(record);
    }

    @Override
    public SysUser selectByPrimaryKey(Long userId) {
        return sysUserMapper.selectByPrimaryKey(userId);
    }

    @Override
    public int updateByPrimaryKeySelective(SysUser record) {
        return sysUserMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SysUser record) {
        return sysUserMapper.updateByPrimaryKey(record);
    }

    @Override
    public void selectByPrimaryKey() {
        sysUserMapper.selectByPrimaryKey();
    }

    @Override
    public List<SysUser> findAll() {
        return sysUserMapper.findAll();
    }


    @Override
    public List<SysUser> findByPage(Integer pageNo, Integer pageSize) {
        Integer limit = (pageNo - 1) * pageSize;
        return sysUserMapper.findByPage(limit, pageSize);
    }

    @Override
    public List<SysUser> findUserByRoleKey(String roleKey) {
        return sysUserMapper.findUserByRoleKey(roleKey);
    }

    @Override
    public List<SysUser> findUserByDeptId(String deptId) {
        return sysUserMapper.findUserByDeptId(deptId);
    }

    @Override
    public List<SysUser> findByUsername(String username) {
        return sysUserMapper.findByUsername(username);
    }


}
